﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Csla.Xaml;
using Accounting.Library;
using System.Windows.Data;
using BusinessConfiguration;

namespace csla4Skeleton.UI.SL.DanhMuc.DM_NganHang
{
    public class DM_NganHang_ListViewModel : ViewModel<DM_NganHangList>
    {
        public DM_NganHang_ListViewModel(string mode)
        {
            BeginRefresh("GetDM_NganHangList", mode);
        }

        public void GetDM_NganHang_ListViewModel(string mode)
        {
            BeginRefresh("GetDM_NganHangList", mode);
        }

        public static readonly DependencyProperty SelectedItemProperty =
          DependencyProperty.Register("SelectedItem", typeof(DM_NganHangInfo), typeof(DM_NganHang_ListViewModel), null);
        public DM_NganHangInfo SelectedItem
        {
            get { return (DM_NganHangInfo)GetValue(SelectedItemProperty); }
            set { SetValue(SelectedItemProperty, value); }
        }

        public void DeleteDM_NganHang(object sender, ExecuteEventArgs e)
        {
            if (e.MethodParameter != null)
            {
                //cast parameter
                string parameter = e.MethodParameter.ToString();
                this.IsBusy = true;
                Accounting.Library.DM_NganHang.DeleteDM_NganHang(int.Parse(parameter), (o, ex) =>
                {
                    BeginRefresh("GetDM_NganHangList", BusinessConfiguration.Configuration.GridViewFetchMode);
                });
                this.IsBusy = false;
            }
        }
    }
}






